<?php
/**
 * fly
 * Copyright By 5920Team (http://www.5920.me)
 * User: yu@5920.me
 * Date: 13-9-29
 * Time: 下午2:33
 */


abstract class DbAdapter
{
    /**
     * @var
     */
    public $link;

    /**
     *
     */
    static public function run(){}

    /**
     * @param $host
     * @param $user
     * @param $password
     * @param $database
     * @param string $charset
     * @param int $pConnect
     */
    abstract public function connect($host, $user, $password, $database, $charset = "utf8", $pConnect = 0);

    /**
     * @param $query
     * @return mixed
     */
    abstract public function query($query);

    /**
     * @param $result
     * @return array
     */
    abstract public function fetchAssoc($result);

    /**
     * @return string
     */
    abstract public function insertId();

    /**
     * @return number
     */
    abstract public function affectedRows();

    /**
     * @param $result
     * @return bool
     */
    abstract public function freeResult($result);

    /**
     * @return bool
     */
    abstract public function close();

    /**
     * @return null|string
     */
    abstract public function error();
}